package com.siao.example.libaray.display.view
{
	import com.siao.component.TextInput;
	import com.siao.component.ThumbTextField;
	import com.siao.example.common.configuration.LibarayDisplayTextConfiguration;
	import com.siao.example.common.ui.Layer;
	import com.siao.mvc.View;
	import com.siao.utils.string.trim;
	
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFormat;
	
	/**
	 * 文本视图
	 * @author SiaoLeon
	 */
	public class DisplayTextView extends View
	{
		// -------------------------------------------------------------------------------------------------------- 静态常量
		
		// -------------------------------------------------------------------------------------------------------- 静态变量
		
		// -------------------------------------------------------------------------------------------------------- 静态方法
		
		// -------------------------------------------------------------------------------------------------------- 静态函数
		
		// -------------------------------------------------------------------------------------------------------- 属性
		
		// -------------------------------------------------------------------------------------------------------- 变量
		
		private var container:Sprite;
		
		private var normal:TextField;
		
		private var input:TextInput;
		
		private var thumb:ThumbTextField;
		
		// -------------------------------------------------------------------------------------------------------- 构造
		
		/**
		 * 构造函数
		 */
		public function DisplayTextView()
		{
			super();
			
			this.container = new Sprite();
			this.container.y = 80;
			
			//普通文本
			this.normal = new TextField();
			this.normal.defaultTextFormat = new TextFormat("宋体", 12, 0X000000);
			this.normal.border = true;
			this.normal.x = 20;
			this.normal.y = 20;
			this.normal.width = 200;
			this.normal.height = 20;
			this.normal.text = trim(LibarayDisplayTextConfiguration.TextTrim);
			this.container.addChild(this.normal);
			
			//文本输入框
			this.input = new TextInput("example");
			this.input.defaultTextFormat = new TextFormat("宋体", 12, 0X000000);
			this.input.border = true;
			this.input.x = 20;
			this.input.y = 50;
			this.input.text = LibarayDisplayTextConfiguration.TextInput;
			this.container.addChild(this.input);
			
			//缩略文本
			this.thumb = new ThumbTextField();
			this.thumb.defaultTextFormat = new TextFormat("宋体", 12, 0X000000);
			this.thumb.x = 20;
			this.thumb.y = 80;
			this.thumb.width = 200;
			this.thumb.height = 40;
			this.thumb.text = LibarayDisplayTextConfiguration.TextThumb;
			this.container.addChild(this.thumb);
		}
		
		// -------------------------------------------------------------------------------------------------------- 方法
		
		override public function onAdd():void
		{
			Layer.instance.content.addChild(this.container);
		}
		
		override public function onRemove():void
		{
			Layer.instance.content.removeChild(this.container);
		}
	
		// -------------------------------------------------------------------------------------------------------- 函数
	
	}
}
